/*
 * animation.h
 *
 *  Created on: 06.01.2011
 *      Author: 123
 */

#ifndef ANIMATION_H_
#define ANIMATION_H_
#include "Timer.h"
#include <oslib/oslib.h>
#define Time 0
#define aTime 1
#define nextState 2
extern double states[16][16][3];
extern double states_param[16][3];
extern char *LoadingInfo;
//extern pgeFont *nash;
class Animation {
public:
	int AnimNum[16];
	int ang;
	Timer* timer;
	//float states[16][16][3];
	//double states_param[16][3];
	int CurrentState;
private:

	//int Timer;
	bool animate;

public:
	int width;

	void Animate(bool animate) {
		this->animate = animate;
	}
	void Load(const char*);
	Animation() {

		this->animate = true;
		this->CurrentState = 0;
		//this->Timer=Timer;
		// load timer object
		timer = new Timer(0.01);
		// start the timer
		timer->startTimer();
		for (int i = 0; i < 16; i++) {

			AnimNum[i] = 0;

		}
		this->ang = 0;
		animate = 0;

	}
	void Animate() {

		if (timer->getTimer() >= states_param[CurrentState][Time]
				+ states_param[CurrentState][aTime] //&& this->animate) {
		) {
			CurrentState = states_param[CurrentState][2];
			timer->resetTimer();

		}
		//if (!this->animate) {
		//	this->CurrentState = 0;
		//	timer->resetTimer();
		//}

	}
	void CenterXY();

	void Draw(int x, int y);
};
extern OSL_IMAGE* parts[2][16];
#endif /* ANIMATION_H_ */
